package cn.sumpu.app.guoguojie.biz.impl;

import java.util.HashMap;
import java.util.Map;
import cn.sumpu.app.guoguojie.biz.IdentifierBiz;
import cn.sumpu.app.guoguojie.dao.AuxIdentifierDao;
import cn.sumpu.app.guoguojie.exception.AppBusinessException;

/**
 * 数据库表的标识符生成接口.
 * 
 * @author nick
 * @version $Id: IdentifierBizImpl.java, v 0.1 2012-9-10 上午11:27:01 nick Exp $
 */
public class IdentifierBizImpl implements IdentifierBiz {

    private AuxIdentifierDao auxIdentifierDao;

    public void setAuxIdentifierDao(AuxIdentifierDao auxIdentifierDao) {
        this.auxIdentifierDao = auxIdentifierDao;
    }

    @Override
    public String generateId(String table) throws AppBusinessException {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("name", table + "_seq");
        int ret = auxIdentifierDao.getIdBySeq(map);
        return String.valueOf(ret);
    }

}
